package com.syj.collect.utils;

import android.content.Context;
import android.graphics.Bitmap;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition;
import com.previewlibrary.loader.IZoomMediaLoader;
import com.previewlibrary.loader.MySimpleTarget;

import io.reactivex.annotations.Nullable;

public  class TextGLde  implements IZoomMediaLoader {
    @Override
    public void displayImage(@NonNull Fragment fragment, @NonNull String path, ImageView imageView, @NonNull MySimpleTarget mySimpleTarget) {
        Glide.with(fragment)
                .asBitmap()
                .load(path)
                .apply(new RequestOptions().fitCenter())
                .into(new SimpleTarget<Bitmap>() {
                    @Override
                    public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
                        mySimpleTarget.onResourceReady();
                        imageView.setImageBitmap(resource);
                    }
                });

    }

    @Override
    public void displayGifImage(@NonNull Fragment fragment, @NonNull String s, ImageView imageView, @NonNull MySimpleTarget mySimpleTarget) {

    }

    @Override
    public void onStop(@NonNull Fragment fragment) {

    }

    @Override
    public void clearMemory(@NonNull Context c) {

    }
}
